<template>
  <view class="xinguan-view" v-for="(item, index) in acid_data" :key="index">
    <text class="name">{{ item.phy_name }}</text>
    <view class="xinguan-order">
      <text>检测人:</text>
      <text>{{ item.name }}</text>
    </view>
    <view class="xinguan-order">
      <text>检测地点:</text>
      <text>{{ item.address }}</text>
    </view>
    <view class="xinguan-order">
      <text>检测时间:</text>
      <text>{{ item.phy_time }}</text>
    </view>
    <view class="xinguan-order">
      <text>订单编号:</text>
      <text>{{ item.order_number }}</text>
    </view>
    <view class="reg-price"
      ><text>¥{{ item.price }}</text></view
    >
    <!-- 取消预约 -->
    <view class="reg-cancel">
      <text
        :class="item.cancel ? '' : 'prevent_style'"
        @click="Cancel(item._id, index)"
        >{{ item.cancel ? "取消预约" : "已取消预约" }}</text
      >
    </view>
  </view>
</template>

<script setup>
import { ref, reactive, onMounted, toRefs, toRaw } from "vue";
import apiRequest from "~/api";
import { onShow } from "@dcloudio/uni-app";
// NuatauserOrder
let acid_data = ref()
onShow(async () => {
  const res = await apiRequest.NuatauserOrder();
  acid_data.value = res.data
});

async function Cancel(id,index){
const res = await RequestApi.NuataCancel({_id:id})
  if(res.msg == "SUCCESS"){
    acid_data.value[index].cancel = false
  }
}
</script>

<style lang="scss" scoped>
@import url("../../../common-style/vaccine.css");
</style>
